var WarehouseMaterialModel = function (material) {
  BaseModel.call(this);

  var self = this;
  var fn = {
    initData: function (material) {
      var fields = ['id', 'providerName', 'materialName', 'model', 'color', 'colorDescription', 'materialType', 'stockTurnover', 'count',
        'materialCode', 'unit', 'unitPrice', 'tax', 'isTax', 'defaultWarehouse', 'procurementCycles', 'providerNo'
      ];
      self.setDataFromObj(material, fields);

      self.purchaseCount = undefined;
      self.remark = '';

      var unit = self.unit;
      self.countPrecision = SysUtil.getMaterialNumberPrecision(unit, 4);

      var materialDeptId = material.materialDeptId;
      var materialDeptName = material.materialDeptName;
      if (SysUtil.isEmpty(materialDeptName)) {
        materialDeptName = '';
        materialDeptId = '';
      }
      self.materialDeptId = materialDeptId;
      self.materialDeptName = materialDeptName;
    }
  };

  fn.initData(material);
};
